package com.houserent.action;

import action.pojo.Auction;
import my.framework.dao.CommonDao;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.SQLException;
import java.util.List;

/**
 * 列表
 */
public class RecordAction {

    public String PaginationExample(HttpServletRequest request, HttpServletResponse response) throws SQLException {
        //获取从数据库读取到的值
        String auctionname=request.getParameter("auctionname");
        String auctiondesc=request.getParameter("auctiondesc");
        String auctionstarttime=request.getParameter("auctionstarttime");
        String auctionendtime=request.getParameter("auctionendtime");
        String auctionstartprice=request.getParameter("auctionstartprice");

        //sql语句
        String sql="select auctionname,auctiondesc,auctionstarttime,auctionendtime,auctionstartprice from auction";

        //把值存在数组中
        Object[] objects={auctionname,auctiondesc,auctionstarttime,auctionendtime,auctionstartprice};

        //初始化dao
        CommonDao commonDao=new CommonDao();

        //接收从数据库查询的值
        List<Auction> list = commonDao.executeQuery(Auction.class, sql, null);

        //把数据传给前端
        request.setAttribute("list",list);

        return "/list.jsp";
    }
}
